package com.example.demo;

import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class SettingActivity2 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        //找到接收参数的控件
        TextView tvPhone = findViewById(R.id.setting_phone);

        Intent intent = getIntent();

        //String phone = intent.getStringExtra("phone");

        //传递一个对象 利用java的序列化
//             User user = (User) intent.getSerializableExtra("user");
//             String phone = user.toString();

       //传递
        //利用android的序列化
        Account account = intent.getParcelableExtra("account");
        String phone = account.getPhone();

        //把参数设置给控件
        tvPhone.setText(phone);

    }
}